import axios from 'axios'
axios.interceptors.request.use(function(config) {
    let host = "";
    let info = config.headers.info;
    if ("info" == info) {
        // 详情页面的头
        host = "mall.film-ticket.film.info";
    } else if ("cinema" == info) {

        // 影院列表
        host = "mall.film-ticket.cinema.list";
        //有城市的数据
    } else if ("city" == info) {
        host = "mall.film-ticket.city.list";
    } else if ("banner" == info) {
        host = "mall.cfg.common-banner";
    } else if ("dianyin" == info) {
        host = "mall.film-ticket.film.cinema-show-film";
        // 电影院详情页数据
    } else if ("dianyindizhi" == info) {
        host = "mall.film-ticket.cinema.info";
        // 电影院地址数据
    } else if ("schedule" == info) {
        host = "mall.film-ticket.schedule.list";
        // 电影排场数据
    } else if ("SecondaryInfo" == info) {
        host = "mall.act.static-page.info";
    } else if ("cinemaData" == info) {
        host = "mall.film-ticket.cinema.film-show-cinema";
    } else if ("cinemaList" == info) {
        host = "mall.film-ticket.cinema.batch-cinema";
    } else {
        // 列表信息的头
        host = "mall.film-ticket.film.list";
    }

    config.headers = {
        "X-Client-Info": '{"a":"3000","ch":"1002","v":"5.0.4","e":"1598087896889693885431809","bc":"110100"}',
        "X-Host": host,
    };
    return config;
}, function(error) {
    return Promise.reject(error);
})
export default axios;